<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="https://cdn-hangzhou.goeasy.io/goeasy.js"></script>
    <script type="text/javascript" src="Js/jquery-1.7.2.js"></script>
    <title>用户登录</title>
</head>
<body>
<table width="88%" border="0" style="width: 80%;">
    <tr>
        <td>登录名：</td>
        <td><input type="text" id="username" name="username" value="fly"/></td>
        <td>密码：</td>
        <td><input type="password" id="password" name="password"
                   value="123456"/></td>
    </tr>
</table>
<table>
    <tr>
        <td><p style="font-size: 32px; margin-left: 360px; margin-top: 300px;">Windows端登录确认</p></td>
    </tr>
    <tr>
        <td><input
                style="background-color: green; color: white; margin-left: 400px; margin-top: 500px; height: 80px; width: 200px; font-size: 28px;"
                type="button" onclick="login()" value="确认登录"/></td>
    </tr>
</table>


</body>

<script type="text/javascript">
    function login() {
        $.post("/phoneLogin", {
            uuid: $.getUrlParam('uuid'),
            username: $("#username").val(),
            password: $("#password").val()
        }, function (data, status) {
            if (data == "false") {
                alert("二维码过期,请重新刷新网页获取二维码");
            } else {
                alert("登录成功");
                window.location.href = "QRhome.jsp";

            }
            /*  当时考虑也可以在此处进行消息推送  */
            /*   var goEasy = new GoEasy({appkey:'BC-851eb9ce50e94c699fba4b312b0d0f42'});
                 goEasy.publish({  channel: '通知',message: 'Hello world!'    });

             */

        });

    }

    //获取网页参数
    (function ($) {
        $.getUrlParam = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return unescape(r[2]);
            return null;
        }
    })(jQuery);
</script>
</html>